<template>
    <div>
<h1>门店信息显示</h1>
<table class="table table-bordered" border="1">
    <thead>
        <tr>
        <td>编号</td>
        <td>订单数量</td>
        <td>实际收款</td>
        <td>平均售价</td>
        <td>退款金额</td>
        <td>门店趋势</td>
        <td>门店编号</td>
        <td>操作</td>
    </tr>
    </thead>
    <tbody>
        <tr v-for="item in xs">
        <td>{{item.shop_id}}</td>
        <td>{{item.shop_shul}}</td>
        <td>{{item.shop_actual}}</td>
        <td>{{item.shop_Price}}</td>
        <td>{{item.shop_Amoutn}}</td>
        <td>{{item.shop_Trends}}</td>
        <td>{{item.shop_wjid}}</td>
        <td><a href="#" @click="xg(item.shop_id)">修改</a></td>
    </tr>
    </tbody>
    


</table>

当前第{{fy.pageindex}} 共{{fy.ys}}页 共{{fy.count }}行
<a href="#" @click="fyxs('a')">首页</a>
<a href="#" @click="fyxs('b')">上一页</a>
<a href="#" @click="fyxs('c')">下一页</a>
<a href="#" @click="fyxs('d')">尾页</a>
    </div>
</template>

<script setup lang="ts">
import { ref,onMounted } from "vue";
import axios from "axios";
import { useRouter } from "vue-router";

const Router=useRouter();
onMounted(()=>{


    pdxs();
})


const xs=ref([{


    shop_id: 0,
  shop_shul: 0,
  shop_actual: 0,
  shop_Price: 0,
  shop_Amoutn: 0,
  shop_Trends: "",
  shop_wjid: 0


}])



const fy=ref({

    pageindex:1,
pageszie:3,
count:0,
ys:0



})





const pdxs=()=>{
axios.get('https://localhost:7268/api/md/mdxxlist',{
    params:{

        pageindex:fy.value.pageindex,
        pagesize:fy.value.pageszie
    }
  
})
.then(res=>{
    console.log(res.data)
    xs.value=res.data.pagedate

    fy.value.count=res.data.pagecount
    fy.value.ys=res.data.totalcount

    
})
.catch(error=>{

console.log(error)

})





}


const fyxs=(fyid:string)=>{

    switch (fyid) {
        case 'a':
        fy.value.pageindex=1;
        pdxs();
            break;
    

            case 'b':
        if(fy.value.pageindex>1)
    {
        fy.value.pageindex--
        pdxs();

    }
    else{
       alert('当前第一页');

    }
            break;
    


            case 'c':
        if(fy.value.pageindex<fy.value.ys)
    {
        fy.value.pageindex++
        pdxs();

    }
    else{
       alert('当前是最后一页');

    }
            break;
    


            case 'd':
        fy.value.pageindex=fy.value.ys;
        pdxs();
            break;
    }


}


const xg=(gxid:number)=>{
    Router.push({
      name:"mdxxxg",
      params:{

         id:gxid

      }



    })




}

</script>

<style scoped>

</style>